package FileIO.ReaderWriter;

import java.io.*;

public class useCharArrayWriter {
    public static void main(String[] args) throws IOException {
        Reader reader = new InputStreamReader(new FileInputStream("src/main/data/hello.txt"), "GB2312");
        try {
            CharArrayWriter writer = new CharArrayWriter();
            char[] cbuf = new char[1024];
            int charsRead = 0;
            while ((charsRead = reader.read(cbuf)) != -1) {
                writer.write(cbuf, 0, charsRead);
            }
            System.out.println(writer.toString());
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            reader.close();
        }
    }
}
